package com.machine.action.admin;

import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.apache.struts2.ServletActionContext;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.machine.bean.RecommendBean;
import com.machine.dao.search.SearchDao;
import com.opensymphony.xwork2.ActionSupport;

@Component("recommendedAction")
@Scope("prototype")
public class RecommendedAction extends ActionSupport {
	private static final long serialVersionUID = 1L;
	
	private SearchDao SearchDao;
	
	public SearchDao getSearchDao() {
		return SearchDao;
	}
	
	@Resource
	public void setSearchDao(SearchDao searchDao) {
		SearchDao = searchDao;
	}

	@Override
	public String execute() throws Exception {
		List<Map<RecommendBean, String>> list = SearchDao.getrecommended();
		ServletActionContext.getRequest().setAttribute("recommend", list);
		return SUCCESS;
	}
}
